import { defHttp } from '/@/utils/http/axios';
import { useMessage } from "/@/hooks/web/useMessage";
const { createConfirm } = useMessage();

enum Api {
	list = '/shop/bsBasiclayoutShop/list',
	save = '/shop/bsBasiclayoutShop/add',
	edit = '/shop/bsBasiclayoutShop/edit',
	deleteOne = '/shop/bsBasiclayoutShop/delete',
	deleteBatch = '/shop/bsBasiclayoutShop/deleteBatch',
	importExcel = '/shop/bsBasiclayoutShop/importExcel',
	exportXls = '/shop/bsBasiclayoutShop/exportXls',
	coupleShopRoomList = '/shop/bsBasiclayoutShop/listCoupleShopRoomByMainId',
	coupleShopRoomSave = '/shop/bsBasiclayoutShop/addCoupleShopRoom',
	coupleShopRoomEdit = '/shop/bsBasiclayoutShop/editCoupleShopRoom',
	coupleShopRoomDelete = '/shop/bsBasiclayoutShop/deleteCoupleShopRoom',
	coupleShopRoomDeleteBatch = '/shop/bsBasiclayoutShop/deleteBatchCoupleShopRoom',
	coupleShopPdtList = '/shop/coupleShop/listCoupleShopPdtByMainId',
	coupleShopPdtSave = '/shop/coupleShop/addCoupleShopPdt',
	coupleShopPdtEdit = '/shop/coupleShop/editCoupleShopPdt',
	getScenicListByTenant = '/travelline/getScenicListByTenant/',
	coupleShopPdtDelete = '/shop/coupleShop/deleteCoupleShopPdt',
	coupleShopPdtDeleteBatch = '/shop/coupleShop/deleteBatchCoupleShopPdt',
}

export const testLzApi = (params) => {
	defHttp.lzApiPost({url:Api.getScenicListByTenant})
}



/**
 * 导出api
 * @param params
 */
export const getExportUrl = Api.exportXls;
/**
 * 导入api
 */
export const getImportUrl = Api.importExcel;
/**
 * 列表接口
 * @param params
 */
export const list = (params) =>
	defHttp.get({ url: Api.list, params });




/**
 * 删除单个
 */
export const deleteOne = (params, handleSuccess) => {
	return defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => {
		handleSuccess();
	});
}
/**
 * 批量删除
 * @param params
 */
export const batchDelete = (params, handleSuccess) => {
	createConfirm({
		iconType: 'warning',
		title: '确认删除',
		content: '是否删除选中数据',
		okText: '确认',
		cancelText: '取消',
		onOk: () => {
			return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
				handleSuccess();
			});
		}
	});
}
/**
 * 保存或者更新
 * @param params
 */
export const saveOrUpdate = (params, isUpdate) => {
	let url = isUpdate ? Api.edit : Api.save;
	let extInfors = {}
	extInfors.carNum = params.carNum
	extInfors.concacttelUserName = params.concacttelUserName
	extInfors.gis = params.gis
	params.extinfors = JSON.stringify(extInfors)
	return defHttp.post({ url: url, params });
}

/**
 * 列表接口
 * @param params
 */
export const coupleShopRoomList = (params) => {
	if (params['mainId']) {
		return defHttp.get({ url: Api.coupleShopRoomList, params });
	}
	return Promise.resolve({});
}


/**
 * 删除单个
 */
export const coupleShopRoomDelete = (params, handleSuccess) => {
	return defHttp.delete({ url: Api.coupleShopRoomDelete, params }, { joinParamsToUrl: true }).then(() => {
		handleSuccess();
	});
}
/**
 * 批量删除
 * @param params
 */
export const coupleShopRoomDeleteBatch = (params, handleSuccess) => {
	createConfirm({
		iconType: 'warning',
		title: '确认删除',
		content: '是否删除选中数据',
		okText: '确认',
		cancelText: '取消',
		onOk: () => {
			return defHttp.delete({ url: Api.coupleShopRoomDeleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
				handleSuccess();
			});
		}
	});
}
/**
 * 保存或者更新
 * @param params
 */
export const coupleShopRoomSaveOrUpdate = (params, isUpdate) => {
	let url = isUpdate ? Api.coupleShopRoomEdit : Api.coupleShopRoomSave;
	return defHttp.post({ url: url, params });
}
/**
 * 导入
 */
export const coupleShopRoomImportUrl = '/shop/coupleShop/importCoupleShopRoom'

/**
 * 导出
 */
export const coupleShopRoomExportXlsUrl = '/shop/coupleShop/exportCoupleShopRoom'

/**
 * 列表接口
 * @param params
 */
export const coupleShopPdtList = (params) => {
	if (params['shopId']) {
		return defHttp.get({ url: Api.coupleShopPdtList, params });
	}
	return Promise.resolve({});
}


/**
 * 删除单个
 */
export const coupleShopPdtDelete = (params, handleSuccess) => {
	return defHttp.delete({ url: Api.coupleShopPdtDelete, params }, { joinParamsToUrl: true }).then(() => {
		handleSuccess();
	});
}
/**
 * 批量删除
 * @param params
 */
export const coupleShopPdtDeleteBatch = (params, handleSuccess) => {
	createConfirm({
		iconType: 'warning',
		title: '确认删除',
		content: '是否删除选中数据',
		okText: '确认',
		cancelText: '取消',
		onOk: () => {
			return defHttp.delete({ url: Api.coupleShopPdtDeleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
				handleSuccess();
			});
		}
	});
}
/**
 * 保存或者更新
 * @param params
 */
export const coupleShopPdtSaveOrUpdate = (params, isUpdate) => {
	let url = isUpdate ? Api.coupleShopPdtEdit : Api.coupleShopPdtSave;
	return defHttp.post({ url: url, params });
}
/**
 * 导入
 */
export const coupleShopPdtImportUrl = '/shop/coupleShop/importCoupleShopPdt'

/**
 * 导出
 */
export const coupleShopPdtExportXlsUrl = '/shop/coupleShop/exportCoupleShopPdt'